<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%-- 加入访问控制 --%>
<c:if test="${sessionScope.frontUser==null}">
	<script>
		alert("请登录");
		location.href="login.jsp";
	</script>
</c:if>
<!DOCTYPE HTML>
<html>
	<head>
		<title>simple and flat user interface kit Template :: w3layouts</title>
		<link href="${pageContext.request.contextPath }/front/web/css/style.css" rel='stylesheet' type='text/css' />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="shortcut icon" type="image/x-icon" href="${pageContext.request.contextPath }/front/web/images/fav-icon.png" />
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
		<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
		<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=DDd05fcba9fea5b83bf648515e04fc4c"></script>
		<script type="application/x-javascript">
			addEventListener("load", function() {
				setTimeout(hideURLbar, 0);
			}, false);

			function hideURLbar() {
				window.scrollTo(0, 1);
			}
		</script>
		<!----webfonts---->
		<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
		<!----//webfonts---->
		<!----Calender -------->
		<script src="${pageContext.request.contextPath }/front/web/js/jquery.min.js"></script>
		<link rel="stylesheet" href="${pageContext.request.contextPath }/front/web/css/clndr.css" type="text/css" />
		<script src="${pageContext.request.contextPath }/front/web/js/underscore-min.js"></script>
		<script src="${pageContext.request.contextPath }/front/web/js/moment-2.2.1.js"></script>
		<script src="${pageContext.request.contextPath }/front/web/js/clndr.js"></script>
		<script src="${pageContext.request.contextPath }/front/web/js/site.js"></script>
		<!----End Calender -------->
		<!-- bxSlider Javascript file -->
		<script src="${pageContext.request.contextPath }/front/web/js/jquery.bxslider.min.js"></script>
		<!-- bxSlider CSS file -->
		<link href="${pageContext.request.contextPath }/front/web/css/jquery.bxslider.css" rel="stylesheet" />
		<script>
			$(document).ready(function() {
				$('.bxslider').bxSlider();
			});
		</script>
		<!-- bxSlider Javascript file -->
		<!-- chat-settings-drop-down-menu -->
		<script src="${pageContext.request.contextPath }/front/web/js/dropit.js"></script>
		<script>
			$(document).ready(function() {
				$('.menu').dropit({
					action: 'hover'
				});
			});
		</script>
		<!---- chat-settings-drop-down-menu---->
			 <link href="${pageContext.request.contextPath }/front/web/css/perfect-scrollbar.css" rel="stylesheet">
		      <script src="${pageContext.request.contextPath }/front/web/js/jquery.mousewheel.js"></script>
		      <script src="${pageContext.request.contextPath }/front/web/js/perfect-scrollbar.js"></script>
		      <script>
			      jQuery(document).ready(function ($) {
			        "use strict";
			        $('#Default').perfectScrollbar();
			      });
			    </script>
		<!---- chat-settings-drop-down-menu---->
	</head>
	<body>
		<!---start-wrap---->
		<div class="wrap">
			<!---start-content---->
			<div class="content">
				<!---start-left-content---->
				<div class="left-content">
					<!---start-left-content-colum1---->
					<div class="start-left-content-colum1">
						<!---start-status---->
						<div class="status-grid">
							<div class="status-grid-head">
								
							</div>
							<div class="status-people-pic">
								<!-- 这儿放头像 -->
								<!-- 默认头像 -->
								<c:if test="${sessionScope.frontUser.u_img ==null}">
									<img id='uimg' class="stat-people" src="${pageContext.request.contextPath }/front/web/images/status-people-pic.png" title="people-name" />
								</c:if>
								<!-- 自定义头像 -->
								<c:if test="${sessionScope.frontUser.u_img !=null}">
									<img id='uimg' class="stat-people" style="width:90px;height:90px" src="${pageContext.request.contextPath }/DownloadServlet?fileName=${sessionScope.frontUser.u_img}"  title="people-name" />
								</c:if>
								<img class="people-avilabel" src="${pageContext.request.contextPath }/front/web/images/avila.png" title="avilabel" /> 
								<h2>${sessionScope.frontUser.u_name}</h2>
								<span>欢迎使用 生活愉快</span>
							</div>
							<div class="status-corrent">
								<ul>
									<li><a class="appont" href="#" id='myself'>个人中心</a></li>
									<li><a class="client" href="#" id='Ann'>公告栏</a></li>
									
									<div class="clear"> </div>
								</ul>
							</div>
							<div class="clear"> </div>
						</div>
						<!---//End-status---->
						<div class="clear"> </div>
						<!---start-chat-sectioin---->
						<div class="chat-section">
							<div class="chat-header">
								<div class="chat-header-left">
									<span> </span>
								</div>
								<div class="chat-header-right">
									<span class="menu"> 
										<li>
									        <a class="chat-setting" href="#"> </a>
									        <ul>
									            <li><a href="${pageContext.request.contextPath}/UserController?op=frontUserClose"><label class="user-logout"> </label>退出</a></li>
									        </ul>
									    </li>
									</span>
								</div>
								<div class="clear"> </div>
							</div>
							<!----start-search-form--->
							<div class="search-form" id="queryAnnForm">
								<form>
									<div style="width: 300px;height: 40px;">
										<input type="text" id="keyWord" name="titlekey" placeholder="输入标题关键字查询"  value="${empty requestScope.titlekey?'':requestScope.titlekey}" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Search..';}" style="float: left;margin-left: -4px;">
										<input  type="button" id="searchBtn" name="searchBtn" class="form-control" value="搜索" style="float: left;width: 50px;"/>	
										<input  type="button" id="clearBtn" class="form-control" value="清除" style="float: left;width: 50px;"/>									
									</div>
								</form>
							</div>
							<!----//End-search-form--->
								
							<!-- 公告栏显示start -->
							<div class="chat-people-grids contentHolder" id="Default">
								
							</div>
							<!-- 公告栏显示end -->
						</div>
						<!---//End-chat-sectioin---->
					</div>
					<!---//End-left-content-colum1---->
					<!---start-left-content-colum2---->
					<div class="start-left-content-colum2">
						<!---start-clender---->
						<div class="calender-grid">
							<div class="calender-left">
								<div class="cal-wather">
									<h2 id="temperature"></h2>
									<span id="weatherInfo"></span>
									<p id="cityAndTime" style="width:200px"></p>
								</div>
							</div>
							<div class="calender calender-right">
								<div class="column_right_grid">
			                      <div class="cal1"><div class="clndr"><div class="clndr-controls"><div class="clndr-control-button"><p class="clndr-previous-button">previous</p></div><div class="month">May 2014</div><div class="clndr-control-button rightalign"><p class="clndr-next-button">next</p></div></div><table class="clndr-table" border="0" cellspacing="0" cellpadding="0"><thead><tr class="header-days"><td class="header-day">S</td><td class="header-day">M</td><td class="header-day">T</td><td class="header-day">W</td><td class="header-day">T</td><td class="header-day">F</td><td class="header-day">S</td></tr></thead><tbody><tr><td class="day adjacent-month last-month calendar-day-2014-04-27"><div class="day-contents">27</div></td><td class="day adjacent-month last-month calendar-day-2014-04-28"><div class="day-contents">28</div></td><td class="day adjacent-month last-month calendar-day-2014-04-29"><div class="day-contents">29</div></td><td class="day adjacent-month last-month calendar-day-2014-04-30"><div class="day-contents">30</div></td><td class="day calendar-day-2014-05-01"><div class="day-contents">1</div></td><td class="day calendar-day-2014-05-02"><div class="day-contents">2</div></td><td class="day calendar-day-2014-05-03"><div class="day-contents">3</div></td></tr><tr><td class="day calendar-day-2014-05-04"><div class="day-contents">4</div></td><td class="day calendar-day-2014-05-05"><div class="day-contents">5</div></td><td class="day calendar-day-2014-05-06"><div class="day-contents">6</div></td><td class="day calendar-day-2014-05-07"><div class="day-contents">7</div></td><td class="day calendar-day-2014-05-08"><div class="day-contents">8</div></td><td class="day calendar-day-2014-05-09"><div class="day-contents">9</div></td><td class="day calendar-day-2014-05-10"><div class="day-contents">10</div></td></tr><tr><td class="day calendar-day-2014-05-11"><div class="day-contents">11</div></td><td class="day calendar-day-2014-05-12"><div class="day-contents">12</div></td><td class="day calendar-day-2014-05-13"><div class="day-contents">13</div></td><td class="day calendar-day-2014-05-14"><div class="day-contents">14</div></td><td class="day calendar-day-2014-05-15"><div class="day-contents">15</div></td><td class="day calendar-day-2014-05-16"><div class="day-contents">16</div></td><td class="day calendar-day-2014-05-17"><div class="day-contents">17</div></td></tr><tr><td class="day calendar-day-2014-05-18"><div class="day-contents">18</div></td><td class="day calendar-day-2014-05-19"><div class="day-contents">19</div></td><td class="day calendar-day-2014-05-20"><div class="day-contents">20</div></td><td class="day calendar-day-2014-05-21"><div class="day-contents">21</div></td><td class="day calendar-day-2014-05-22"><div class="day-contents">22</div></td><td class="day calendar-day-2014-05-23"><div class="day-contents">23</div></td><td class="day calendar-day-2014-05-24"><div class="day-contents">24</div></td></tr><tr><td class="day calendar-day-2014-05-25"><div class="day-contents">25</div></td><td class="day calendar-day-2014-05-26"><div class="day-contents">26</div></td><td class="day calendar-day-2014-05-27"><div class="day-contents">27</div></td><td class="day calendar-day-2014-05-28"><div class="day-contents">28</div></td><td class="day calendar-day-2014-05-29"><div class="day-contents">29</div></td><td class="day calendar-day-2014-05-30"><div class="day-contents">30</div></td><td class="day calendar-day-2014-05-31"><div class="day-contents">31</div></td></tr></tbody></table></div></div>
							   </div>
							</div>
							<div class="clear"> </div>
						</div>
						<!---//End-clender---->
						<div class="clear"> </div>
						<!---start-upload-status---->
						<div class="upload-download-status-grids" id="allmap">
							
						</div>
						<!---//End-upload-status---->
						
					</div>
					<!---//End-left-content-colum2---->
					<div class="clear"> </div>
				</div>
				<!---//End-left-content---->
				<!----start-right-ccontent--->
				<div class="right-content">
					<!----start-text-slider---->
					<!---slider-catption---->
					<ul class="bxslider">
					  <li><img src="${pageContext.request.contextPath }/front/web/images/slider-pic1.jpg" /><p><span>广告</span>需要发布广告请联系我 <small>联系电话:12321464676767</small></p>  <label>156 <i> </i> </label> </li>
					  <li><img src="${pageContext.request.contextPath }/front/web/images/slider-pic1.jpg" /><p><span>ELSA</span>Marcaroon muffin jelly-o donut cotton candy powder apple pie. <small>Topping ice cream pstry caramels gummi.Toffee halvah</small></p>  <label>156 <i> </i> </label> </li>
					  <li><img src="${pageContext.request.contextPath }/front/web/images/slider-pic1.jpg" /><p><span>ELSA</span>Marcaroon muffin jelly-o donut cotton candy powder apple pie. <small>Topping ice cream pstry caramels gummi.Toffee halvah</small></p>  <label>156 <i> </i> </label> </li>
					  <li><img src="${pageContext.request.contextPath }/front/web/images/slider-pic1.jpg" /><p><span>ELSA</span>Marcaroon muffin jelly-o donut cotton candy powder apple pie. <small>Topping ice cream pstry caramels gummi.Toffee halvah</small></p>  <label>156 <i> </i> </label> </li>
					</ul>
					<!---slider-catption---->
					<!----start-alert-message---->
						<div class="alert-message">
							<ul id="myTab" class="nav nav-pills">
								<li class="active ">
									<a href="#site" data-toggle="tab" class="label label-info">站点查询</a>
								</li>
								<li>
									<a href="#bus" data-toggle="tab" class="label label-info">车辆查询</a>
								</li>
								<li >
									<a href="#route" data-toggle="tab" class="label label-info">路线规划</a>
								</li>
							</ul>
							<div id="myTabContent" class="tab-content center-block">
								<div class="tab-pane fade in active" id="site">
									<div class="row">
								        <div class="col-sm-8">
											<form class="bs-example bs-example-form" role="form" method="get">
								                <div class="input-group">
								                    <input type="text" class="form-control" placeholder="请输入站点" id="sitename" name="sitename">
								                    <span class="input-group-btn">
								                        <button class="btn btn-info" type="button" id="queryBtn_1">查询</button>
								                    </span>
								                </div>
								            </form>
								         </div>
								    </div>
								    
								</div>
								<div class="tab-pane fade" id="bus">
									<div class="row">
								        <div class="col-sm-8">
											<form class="bs-example bs-example-form" role="form">
								                <div class="input-group">
								                    <input type="text" class="form-control" placeholder="请输入车辆编号" id="busId">
								                    <span class="input-group-btn">
								                        <button class="btn btn-info" type="button" id="queryBtn_2">查询</button>
								                    </span>
								                </div>
								  			</form>
								         </div>
								    </div>
								   
								</div>
								<div class="tab-pane fade" id="route">
									<div class="row">
								        <div class="col-sm-8">
									        <form class="bs-example bs-example-form" role="form">
										        <div class="input-group">
										            <span class="input-group-addon label-info">出发地</span>
										            <input type="text" class="form-control" id="beginname" placeholder="请输入出发地">
										        </div>
										        <br>
										       	<div class="input-group">
										            <span class="input-group-addon label-info">目的地</span>
										            <input type="text" class="form-control" id="endname" placeholder="请输入目的地">
										        </div>
										        <br>
										        <div class="input-group">
										            <button type="button" class="btn btn-info" id="routeQuery">查询</button>
										        </div>
										    </form>
										</div>
								    </div>
								   
								</div>
							</div>
						</div>
						<!----//End-alert-message---->	
						<div id="showQueryInfo" class="col-sm-10 panel panel-primary">
										
						</div>
				<!---start-form-section--->
				<div class="form-section">
					<!---start-form-textarea---->
					<div class="form-text-box">
						<form>
						    <input type="text" class="form-control" id="title" name="title" style="width:100%" value="" placeholder="请输入标题" />
							<br>
							<textarea  rows="2" cols="70" id="content" placeholder="请输入内容" required> </textarea>
							<div class="add-map-send">
								
								<div class="send-post">
									<input id="release" type="button" value="发布" />
								</div>
								<div class="clear"> </div>
							</div>
						</form>
					</div>
					<!---//End-form-textarea---->
					<div class="clear"> </div>
				</div>
				<!---//End-form-section--->
			</div>
			<div class="clear"> </div>
			<!---//End-content---->
		</div>
		</div>
		<!---End-wrap---->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">用户修改</h4>
				</div>
				<form class="form-horizontal" role="form">
				 <div class="modal-body">
				  <div class="form-group " style="display:none">
                    <label for="lastname" class="control-label col-lg-4">用户编号 </label>
                    <div class="col-lg-6">
                      <input class="form-control" id="userid" name="userid" type="text" readonly="readonly"/>
                    </div>
                  </div>
				  <div class="form-group">
                     	<label for="firstname" class="control-label col-lg-4">用户名</label>
                    <div class="col-lg-6">
                      <input class=" form-control" id="username" name="username" type="text"/>
                    </div>
                  </div>
     			  <div class="form-group ">
                    <label for="password" class="control-label col-lg-4">密码</label>
                    <div class="col-lg-6">
                      <input class="form-control " id="password" name="password" type="password" />
                    </div>
                  </div>
                  <div class="form-group ">
                    <label for="lastname" class="control-label col-lg-4">手机号</label>
                    <div class="col-lg-6">
                      <input class="form-control" id="usertel" name="usertel" type="text"/>
                    </div>
                  </div>
                  <div class="form-group ">
                    <label for="confirm_sex" class="control-label col-lg-4">性别</label>
                    <div class="col-lg-6">
                      <select class="form-control" id="sex" name="sex">
                      	<option value="default">请选择</option>
						<option value="男">男</option>
						<option value="女">女</option>
					  </select>          
					</div>
                  </div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="button" class="btn btn-primary" id="updatebtn">提交更改</button>
					</div>
				 </div>
				</form>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
	</body>
	<!-- 公告栏加载 -->
	<script type="text/javascript">
		$(function(){
			//进入页面发送ajax请求显示文章数据
			$.ajax({
				async: true,
				url:"${pageContext.request.contextPath}/AnnouncementController",
				type:"POST",
				data:{op:"showNewAnn_ajax"},
				dataType:"json",
				contentType:"application/x-www-form-urlencoded",
				success:function(result){
					//将html拼接写成方法
					showData(result);
				},
				error:function(){
					alert("异步请求失败");
				}
			})
			//个人信息监听事件
			$("#myself").click(function(){
				$("#queryAnnForm").css("display","none");
				//首先需要清空页面数据
				$("#Default").empty();
				$("#Default").append("<table class=\"table\">\r\n" + 
						"								  <thead>\r\n" + 
						"								    <tr>\r\n" + 
						"								      <th colspan=\"2\">个人信息</th>\r\n" + 
						"								    </tr>\r\n" + 
						"								  	</thead>\r\n" + 
						"								  <tbody style=\"text-align: center;\">\r\n" + 
						"								  	\r\n" + 
						"								    <tr class=\"active\">\r\n" + 
						"								      <td>姓名</td>\r\n" + 
						"								      <td id='uname'>${sessionScope.frontUser.u_name}</td>\r\n" + 
						"								    </tr>\r\n" + 
						"								    <tr class=\"success\">\r\n" + 
						"								      <td>性别</td>\r\n" + 
						"								      <td id='usex'>${sessionScope.frontUser.u_sex}</td>\r\n" + 
						"								    </tr>\r\n" + 
						"								    <tr class=\"warning\">\r\n" + 
						"								      <td>联系电话</td>\r\n" + 
						"								      <td id='utel'>${sessionScope.frontUser.u_tel}</td>\r\n" + 
						"								    </tr>\r\n" + 
						"								    <tr class=\"danger\">\r\n" + 
						"								       <td colspan=\"2\"><a href=\"\" data-toggle=\"modal\" data-target=\"#myModal\"\r\n" + 
						"									data-uid=\"${sessionScope.frontUser.u_id}\"\r\n" + 								
						"									data-uname=\"${sessionScope.frontUser.u_name}\"\r\n" + 
						"									data-upassword=\"${sessionScope.frontUser.u_password}\"\r\n" + 
						"									data-utel=\"${sessionScope.frontUser.u_tel}\"\r\n" + 
						"									data-usex=\"${sessionScope.frontUser.u_sex}\"\r\n" + 
						"									onclick=\"showUpdateData(this)\">\r\n" +
						"									    <button type=\"button\" class=\"btn btn-info\" >修改信息</button></a></td>\r\n" + 
						"								\r\n" + 
						"								    </tr>\r\n" + 
						"								  </tbody>\r\n" + 
						"								</table>"
						
				
				)
				
			})
			//公告栏
			$("#Ann").click(function(){
				location.reload();
			})
			

			//站点查询监听事件
			$("#queryBtn_1").click(function(){
				//首先需要清空页面数据
				$("#showQueryInfo").empty();
				$.get("${pageContext.request.contextPath}/BusController",
						{
					       op:"queryBus",
					       s_name:$("#sitename").val().trim()
					    },
						function(result){
							$.each(result,function(index,busInfo){
								$("#showQueryInfo").append("<h3>"+busInfo.b_id+"路</h3>"+
										            "<p style='color: #BBBBBB;'>开往"+"\t"+busInfo.b_end+"</p>");
							})
						},"json")
			})
			//车辆编号查询监听事件
			$("#queryBtn_2").click(function(){
				//首先需要清空页面数据
				$("#showQueryInfo").empty();
				var location="";
				$.get("${pageContext.request.contextPath}/BusController",
						{
					       op:"queryBusRoute",
					       b_id:$("#busId").val().trim()
					    },
						function(result){
							$.each(result,function(index,route){
								if(index<result.length-1){
									location+=route+"-->";
						
								}else{
									location+=route;
								}
							})
							$("#showQueryInfo").append(location);
						},"json");
			})
			//起点,终点查询监听事件
			$("#routeQuery").click(function(){
				//首先需要清空页面数据
				$("#showQueryInfo").empty();
				var location="</br>";
				$.get("${pageContext.request.contextPath}/BusController",
						{
					       op:"routeQuery",
					       b_begin:$("#beginname").val().trim(),
					       b_end:$("#endname").val().trim()
					    },
						function(result){
					    	if(result!=null){
								if(result[1].length>0){
									$.each(result[1],function(index,nonstop){
										console.log(nonstop)
										location+="<span class='label label-info'>"+nonstop+"路 </span></br>";
									})
								}
								if(result[2].length>0){
									$.each(result[2],function(index,change){
										location+="<span class='label label-info'>"+change.startBus+"</span><span > --></span><span class='label label-info'>"+change.transferStation+"</span><span>--></span><span class='label label-info'>"+change.endBus+"</span></br>";
									})
								}
							}
							
							$("#showQueryInfo").append(location);
						},"json");

			})
			 $("#release").click(function(){
			   //发送ajax修改操作
			   $.get("${pageContext.request.contextPath}/AnnouncementController",
					{
						op:"addNewAnn_ajax",
						a_title: $("#title").val(),  
					    a_content:$("#content").val(),
					},
					function(flag){
					
						if(flag){
							//刷新数据,发送ajax请求
							$.get("${pageContext.request.contextPath}/AnnouncementController",
								{
									op:"showNewAnn_ajax",
								},
								function(result){
									//将html拼接写成方法
									showData(result);
								},"json")
						}else{
							alert("刷新失败")
						}
					},"json")
		 })
			//搜索按钮的模糊查询
			$("#searchBtn").click(function(){
				//用户输入的模糊查询关键字
				key=$("#keyWord").val();
				//判断搜索框中的值是否为空,则执行全查方法
				if(key==null){
					//发送ajax请求  首页
					$.get("${pageContext.request.contextPath }/AnnouncementController",{op:"showNewAnn_ajax",titlekey:key},function(result){
						//显示数据写成一个方法,以后就不用在做拼接
						showData(result);
					},"json")
				
				//不为空，执行模糊查询
				}else{
					//发送ajax请求  首页
					$.get("${pageContext.request.contextPath }/AnnouncementController",{op:"queryByTitleLike",titlekey:key},function(result){
						//显示数据写成一个方法,以后就不用在做拼接
						showData(result);
					},"json")
				}
			});
			
			//清除按钮实现
			$("#clearBtn").click(function(){
				key="";
				$("#keyWord").val("");
			})
			
		})
		
		function showData(result){
		//首先需要清空页面数据
		$("#Default").empty();
		//声明一个默认头像路径
		var img="${pageContext.request.contextPath }/front/web/images/chat-people-pic1.png";
		//显示文章数据列表
		$.each(result,function(index,ann){
			//判断用户头像是否为空
			 if(ann.a_user.u_img!=null){
				 img="${pageContext.request.contextPath}/DownloadServlet?fileName="+ann.a_user.u_img;
			 } 
			 $("#Default").append("<div class=\"chat-people-grid\">\r\n" + 
					"			<div class=\"chat-people-pic-grid\">\r\n" + 
					"				<img class=\"chat-people-pic\" src=\""+img+"\" title=\"chat-people-name\" />\r\n" + 
					"					<span class=\"chat-people-cstatus\"> </span>\r\n" + 
					"			</div>\r\n" + 
					"			<div class=\"chat-people-message\">\r\n" + 
					"				<h5><a href=\"#\">"+ann.a_title+"</a></h5>\r\n" + 
					"					<p style='width:150px;white-space: nowrap;text-overflow: ellipsis;overflow:hidden;'>"+ann.a_content+"</p>\r\n" + 
					"			</div>\r\n" + 
					"			<div class=\"chat-people-message-post-date\">\r\n" + 
					"				<span><a href=\"#\">"+ann.a_time.substring(0,ann.a_time.length-2)+"</a></span>\r\n" + 
					"			</div>\r\n" + 
					"			<div class=\"clear\"> </div>\r\n" + 
					"		</div>\r\n");
				})
			$("#Default").append("<div class=\"clear\"> </div>\r\n" + 
					"	  		  <div class=\"chat-loder-grid\">\r\n" + 
					"				<span> </span>\r\n" + 
					"	  		  </div>"); 
			
		}
		//在模态框显示要修改的数据
		function showUpdateData(obj) {
			var uid = $(obj).data("uid");
			var uname = $(obj).data("uname");
			var upassword = $(obj).data("upassword");
			var utel = $(obj).data("utel");
			var usex = $(obj).data("usex");
			//显示
			$("#userid").val(uid);
			$("#username").val(uname);
			$("#password").val(upassword);
			$("#usertel").val(utel);
			$("#sex").val(usex);
		}
		//模态框提交修改的监听事件
		   $("#updatebtn").click(function(){
			   //创建对象存放修改后的数据
			   var user={
					    u_id:$("#userid").val(),
					    u_name:$("#username").val(),
						u_password:$("#password").val(),
						u_tel:$("#usertel").val(),
						u_sex:$("#sex").val()  
			   };
			   //发送ajax修改操作
			   $.get("${pageContext.request.contextPath}/UserController",
					{
						op:"frontUpdateUser",
						user:JSON.stringify(user)
					},
					function(flag){
						if(flag){
							
							alert("修改成功");
							location.reload();
						}else{
							alert("修改失败")
						}
					},"json")

		   })
	</script>
	<!-- 天气预报加载 -->
	<script type="text/javascript">
	   $(function(){
			// 百度地图API功能
			var map = new BMap.Map("allmap");
			var point = new BMap.Point(116.331398,39.897445);
			map.centerAndZoom(point,12);
			var geoc = new BMap.Geocoder();    
			
			var geolocation = new BMap.Geolocation();
			geolocation.getCurrentPosition(function(r){
				if(this.getStatus() == BMAP_STATUS_SUCCESS){
					var mk = new BMap.Marker(r.point);
					map.addOverlay(mk);
					map.panTo(r.point);
					var pt = r.point;
					geoc.getLocation(pt, function(rs){
						var addComp = rs.addressComponents;
						var location=addComp.city;
						//进入页面发送ajax请求显示天气情况
						$.ajax({
							async: true,
							url:"${pageContext.request.contextPath}/WeatherAndMapController",
							type:"POST",
							data:{location:location},
							dataType:"json",
							contentType:"application/x-www-form-urlencoded",
							success:function(data){
								$("#temperature").html(data.result.data.realtime.weather.temperature); 
								$("#weatherInfo").html(data.result.data.realtime.weather.info);
								$("#cityAndTime").html(data.result.data.realtime.city_name+" "+data.result.data.realtime.date);
							},
							error:function(){
								alert("异步请求失败");
							}
						})
					  
				})
				}else {
					alert('failed'+this.getStatus());
				}        
			},{enableHighAccuracy: true})
			
			
		})
    </script>
	<!-- 地图 -->
	<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");
    var point = new BMap.Point(116.331398,39.897445);
    map.centerAndZoom(point,12);
  	   
    var geolocation = new BMap.Geolocation();
    geolocation.getCurrentPosition(function(r){
        if(this.getStatus() == BMAP_STATUS_SUCCESS){
            var mk = new BMap.Marker(r.point);
            map.addOverlay(mk);
            map.panTo(r.point);
			//alert('您的位置：'+r.point.lng+','+r.point.lat);
        }
        else {
            alert('failed'+this.getStatus());
        }
    },{enableHighAccuracy: true})
    //启用滚轮放大缩小，默认禁用
    map.enableScrollWheelZoom(true); 
  	//启用地图惯性拖拽，默认禁用
	map.enableContinuousZoom(true); 
    //关于状态码
    //BMAP_STATUS_SUCCESS    检索成功。对应数值“0”。
    //BMAP_STATUS_CITY_LIST    城市列表。对应数值“1”。
    //BMAP_STATUS_UNKNOWN_LOCATION    位置结果未知。对应数值“2”。
    //BMAP_STATUS_UNKNOWN_ROUTE    导航结果未知。对应数值“3”。
    //BMAP_STATUS_INVALID_KEY    非法密钥。对应数值“4”。
    //BMAP_STATUS_INVALID_REQUEST    非法请求。对应数值“5”。
    //BMAP_STATUS_PERMISSION_DENIED    没有权限。对应数值“6”。(自 1.1 新增)
    //BMAP_STATUS_SERVICE_UNAVAILABLE    服务不可用。对应数值“7”。(自 1.1 新增)
    //BMAP_STATUS_TIMEOUT    超时。对应数值“8”。(自 1.1 新增)
	</script>
	

</html>

